package com.ck.ckcloud.powerenvironment.core.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 管理类型枚举
 * 1	空调
 * 2	电表
 * 3	温湿度传感器
 * 4	列头柜
 * 5	监控模块
 * 6	UPS
 * 7	门禁
 * 8	采集器
 * 9	其他设备
 */
@Getter
public enum DeviceTypeEnum {

	AIRCONDITIONING(1,"空调"),

	ELECTRICMETER(2,"电表"),

	TEMPERATUREANDHUMIDITYSENSOR(3,"温湿度传感器"),

	HEADCABINET(4,"列头柜"),

	MONITORINGMODULE(5,"监控模块"),

	UPS(6,"UPS"),

	ACCESSCONTROL(7,"门禁"),

	COLLECTOR(8,"采集器"),

	OTHERDEVICES(9,"其他设备")

	;

	private Integer code;

	private String message;

	DeviceTypeEnum(Integer code, String message) {
		this.code = code;
		this.message = message;
	}

	/**
	 * 根据类型获取文本
	 * @param deviceType
	 * @return
	 */
	public static String getType(Integer deviceType){
		return Arrays.asList(DeviceTypeEnum.values()).stream()
			.filter(m -> m.getCode().equals(deviceType))
			.findFirst().orElse(DeviceTypeEnum.OTHERDEVICES).getMessage();
	}


}
